package cn.yx.common.core.enums;

import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;

/**
 * <p>是否枚举</p>
 *
 * @author Wgssmart
 */
public enum YesNoEnum {

    /**
     * 是与否枚举
     */
    YES("YES", "YES"),
    NO("NO", "NO"),
    Y("Y", "Y"),
    N("N", "N");

    private final String value;
    private final String desc;

    private static final Map<String, YesNoEnum> LOOKUP;

    static {
        LOOKUP = new HashMap<>();
        for (YesNoEnum yesNoEnum : EnumSet.allOf(YesNoEnum.class)) {
            LOOKUP.put(yesNoEnum.getValue(), yesNoEnum);
        }
    }

    YesNoEnum(String value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public String getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }

    public static YesNoEnum findByValue(String value) {
        return LOOKUP.get(value);
    }
}